const Sequelize = require('sequelize');

// Option 1: Passing parameters separately
// const sequelize = new Sequelize('database', 'username', 'password', {
//     host: 'localhost',
//     dialect: "postgres" /* one of 'mysql' | 'mariadb' | 'postgres' | 'mssql' */
// });

// Option 2: Passing a connection URI
const sequelize = new Sequelize('postgres://root:root@localhost:32769/quxia', {
    pool: {
        max: 5,
        min: 0,
        acquire: 30000,
        idle: 10000
    }
});

sequelize
    .authenticate()
    .then(() => {
        console.log('Connection has been established successfully.');
    })
    .catch(err => {
        console.error('Unable to connect to the database:', err);
    });

export default sequelize
